package com.erp.erp_servers.warehouse.imp;

import com.erp.erp_dao.warehouse.IStockDetailDao;
import com.erp.erp_entitys.warehouse.entity.StockDetailEntity;
import com.erp.erp_servers.warehouse.IStockDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName : StockDetailServiceImp
 * @Description : 库存明细实现类
 * @Author : lst
 * @Date: 2020-07-15 08:24
 */
@Service
public class StockDetailServiceImp implements IStockDetailService {

    /**
     * 库存明细接口
     */
    private final IStockDetailDao iStockDetailDao;

    @Autowired
    public StockDetailServiceImp(IStockDetailDao iStockDetailDao) {
        this.iStockDetailDao = iStockDetailDao;
    }

    /**
     * 新增库存明细数据
     * @param stockDetail 实例对象
     * @return id
     */
    @Override
    public int insert(StockDetailEntity stockDetail) {
        return iStockDetailDao.insert(stockDetail);
    }

    /**
     * 通过父id获取库存明细
     * @param id
     * @return
     */
    @Override
    public List<StockDetailEntity> queryByParentId(Integer id) {
        return iStockDetailDao.queryByParentId(id);
    }

    /**
     * 修改
     * @param stockDetail 修改内容
     * @return 影响行数
     */
    @Override
    public int update(StockDetailEntity stockDetail) {
        return iStockDetailDao.update(stockDetail);
    }
}
